<?php
// Author: dolphinigle
// 28 March 2012
include 'config/koneksi.php';

if ($_GET[type] == 'likes') {
  $query = "SELECT COUNT(id_likes) AS cnt FROM likes " .
           "WHERE id_berita='" . $_GET[id] . "'";
} elseif ($_GET[type] == 'dislike') {
  $query = "SELECT COUNT(id_dislike) AS cnt FROM dislike " .
           "WHERE id_berita='" . $_GET[id] . "'";
} else {
  exit('UNRECOGNIZED TYPE PARAMETER');
}

$sql_answer = mysql_query($query);
$ans = mysql_fetch_array($sql_answer);
echo $ans[cnt];
?>
